@echo off
call config.bat
if "%1"=="clear" (
	goto CLEAR
)else if "%1"=="debug" (
	goto DEBUG
)else if "%1"=="release" (
	goto RELEASE
)else if "%1"=="data" (
	goto DATA
)else if "%1"=="run" (
	goto RUN
)

goto END_MAKE

:CLEAR
echo ........ Clear ........
cd..
RD /s /q obj
RD /s /Q bin
RD /s /Q libs
RD /s /q firstlibgles\debug
RD /s /q firstlibgles\release
RD /s /q firstlibgles\common\debug
RD /s /q firstlibgles\common\release
cd make
goto END_MAKE

:RELEASE
echo ........ RELEASE ........
cd..
call android update project -p . -s
call ant release
move bin\%PROJECT_NAME_OLD%-unsigned.apk bin\%PROJECT_NAME%.apk
cd make
goto END_MAKE

:DEBUG
echo ........ DEBUG ........
cd..
call android update project -p . -s
call ant debug
move bin\%PROJECT_NAME_OLD%-debug-unsigned.apk bin\%PROJECT_NAME%.apk
cd make
goto END_MAKE

:DATA
echo ........ DATA ........
bash %ndk-build%
goto END_MAKE

:RUN
echo ........ RUN ........
start cmd /c emulator -avd gingerbread
adb.exe install %PROJECT_DIR%\bin\%PROJECT_NAME%.apk
goto END_MAKE
:END_MAKE